package org.luxor.eshop.payment.service.hystrix;

import org.luxor.commons.core.web.RestStatus;
import org.luxor.commons.core.web.data.R;
import org.luxor.eshop.payment.entity.dto.AccountDto;
import org.luxor.eshop.payment.entity.dto.PaymentReqDto;
import org.luxor.eshop.payment.entity.dto.ReceiptReqDto;
import org.luxor.eshop.payment.service.AccountFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 熔断实现
 *
 * @author Mr.Yan  @date: 2020/9/2
 */
@Component
public class AccountHystrixImpl implements AccountFeign {
    private static Logger logger = LoggerFactory.getLogger(AccountHystrixImpl.class);

    @Override
    public R payment(PaymentReqDto paymentReq) {
        logger.warn("payment Method Response Hystrix Data");
        return R.failed(RestStatus.FEIGN_HYSTRIX);
    }

    @Override
    public R receipt(ReceiptReqDto receiptReq) {
        logger.warn("receipt Method Response Hystrix Data");
        return R.failed(RestStatus.FEIGN_HYSTRIX);
    }

    @Override
    public R<AccountDto> get(String account) {
        logger.warn("get Method Response Hystrix Data");
        return R.failed(RestStatus.FEIGN_HYSTRIX, new AccountDto());
    }
}

